# ============================================================
#  Keamanan akses file — GetContact API Gateway
#  Untuk shared hosting cPanel (Apache 2.2 / 2.4).
# ============================================================

# Matikan directory listing (jangan tampilkan daftar file)
Options -Indexes

# Blokir akses langsung ke file sensitif via browser.
# File-file ini hanya boleh dibaca oleh PHP, bukan oleh publik.
<FilesMatch "(?i)\.(json|md|lock|phar|dist|cache)$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</FilesMatch>

# Blokir file .htaccess itu sendiri
<Files ".htaccess">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</Files>

# Blokir file internal PHP yang bukan endpoint publik.
# Hanya api.php yang boleh diakses lewat web.
<FilesMatch "(?i)^(menu|login_wa|run|smoke_test|smoke_relay|autoload|paths)\.php$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</FilesMatch>
